$("form").submit(function (e) {
    e.preventDefault();
    var form = $(this);
    $.ajax({
      type: form.attr("method"),
      url: form.attr("action"),
      data: form.serialize(),
      dataType: 'json',
      success: function(message) {
        if (message["status"] == "SUCCESS" ){
          var message = "Data successfully saved. ";
          message += "<a onclick=\"location.reload()\">Reload table</a>";
          $(".alert").html(message).css("display", "block");
        }
      }
    });

  });

